package com.bilibili.xzz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bilibili.xzz.entity.Background;
import com.bilibili.xzz.mapper.BackgroundMapper;
import com.bilibili.xzz.service.BackgroundService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BackgroundServiceImpl implements BackgroundService {
@Resource
BackgroundMapper backgroundMapper;


    @Override
    public Background getImageId(Long id) {
        return  backgroundMapper.selectById(id);
    }

    @Override
    public List<Background> getAllImage() {
        return backgroundMapper.selectList(null);
    }

    @Override
    public int deleteImg(Long id) {
        return backgroundMapper.delete(new QueryWrapper<Background>().eq("id",id));
    }

    @Override
    public int insertBG(Background background) {
        return backgroundMapper.insert(background);
    }
}
